package edu.hunis.controller;

import edu.hunis.pojo.User;
import edu.hunis.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    // 使用RESTfull的方式进行处理
    // http://localhost:8088/user/1
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public User findById(@PathVariable("id") Integer id){
        return userService.queryById(id);
    }


    @GetMapping("/login")
    public User login(String telphone,String pwd){
        System.out.println("--login--");

        User u = userService.login(telphone, pwd);
        return u;

    }

}
